{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/pascal/dvp/OpenSource/ImGuiWork/immvision/pybind/pybind_examples\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "import numpy as np\n",
    "import immvision\n",
    "\n",
    "THIS_DIR = sys.path[0]\n",
    "print(THIS_DIR)\n",
    "sys.path.append(THIS_DIR + \"/../src_python\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import immvision\n",
    "\n",
    "p = immvision.ImageParams(refresh_image=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 2.,  0., 50.],\n",
       "       [ 0.,  2.,  0.],\n",
       "       [ 0.,  0.,  1.]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import immvision\n",
    "\n",
    "immvision.make_zoom_pan_matrix((50, 50), 2, (300, 200))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "GlProviderSentinel __init__: calling immvision.InitGlProvider()\n"
     ]
    }
   ],
   "source": [
    "import imgui\n",
    "import immvision.imgui_runner\n",
    "\n",
    "\n",
    "def draw_coords_markers(w, h):\n",
    "    step = 100\n",
    "    for x in range(0, w + step, step):\n",
    "        for y in range(0, h + step, step):\n",
    "            imgui.set_cursor_pos((x, y))\n",
    "            imgui.text(f\"{x=} {y=}\")\n",
    "\n",
    "\n",
    "def gui_test_autosize(params: immvision.imgui_runner.ImguiAppParams, w, h):\n",
    "    draw_coords_markers(w, h)\n",
    "    if imgui.button(\"Exit\"):\n",
    "        params.app_shall_exit = True\n",
    "\n",
    "\n",
    "def main_autosize(w, h):\n",
    "    params = immvision.imgui_runner.ImguiAppParams()\n",
    "    # params.use_power_save = False\n",
    "\n",
    "    def my_gui():\n",
    "        gui_test_autosize(params, w, h)\n",
    "\n",
    "    immvision.imgui_runner.run(my_gui, params)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "main_autosize(200, 600)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "07580d44e519ada64faf1c79f750a40c45d7960b3526f627e875efade47c9e1b"
  },
  "kernelspec": {
   "display_name": "Python 3.9.12 ('venv': venv)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
